#include "CDashboard_TCB.h"

#include <QPaintEvent>
#include <QPainter>

#include "core/CDeviceManager.h"
#include "core/logger.h"

#define DEFINE_DEVICE()                                                            \
    auto deviceid = property("deviceid").toString().toStdString();                 \
    auto device = CDeviceManager::Instance().GetTemperatureControlBoard(deviceid); \
    if (device == nullptr)                                                         \
    {                                                                              \
        MSG(ERROR) << QObject::tr("Operation failed, invalid device object");      \
        return;                                                                    \
    }

CDashboard_TCB::CDashboard_TCB(QWidget* parent) :
    QWidget(parent),
    lockers_(new QButtonGroup(this))
{
    ui.setupUi(this);
    ui.btn_locker_1->installEventFilter(this);
    ui.btn_locker_2->installEventFilter(this);
    ui.btn_locker_3->installEventFilter(this);
    ui.btn_locker_4->installEventFilter(this);
    ui.btn_locker_5->installEventFilter(this);
    ui.btn_locker_6->installEventFilter(this);
    ui.btn_locker_7->installEventFilter(this);
    ui.btn_locker_8->installEventFilter(this);
    ui.btn_locker_9->installEventFilter(this);
    ui.btn_locker_10->installEventFilter(this);
    ui.btn_locker_11->installEventFilter(this);
    ui.btn_locker_12->installEventFilter(this);

    lockers_->addButton(ui.btn_locker_1, 1);
    lockers_->addButton(ui.btn_locker_2, 2);
    lockers_->addButton(ui.btn_locker_3, 3);
    lockers_->addButton(ui.btn_locker_4, 4);
    lockers_->addButton(ui.btn_locker_5, 5);
    lockers_->addButton(ui.btn_locker_6, 6);
    lockers_->addButton(ui.btn_locker_7, 7);
    lockers_->addButton(ui.btn_locker_8, 8);
    lockers_->addButton(ui.btn_locker_9, 9);
    lockers_->addButton(ui.btn_locker_10, 10);
    lockers_->addButton(ui.btn_locker_11, 11);
    lockers_->addButton(ui.btn_locker_12, 12);
    connect(lockers_, SIGNAL(buttonClicked(int)), this, SLOT(event_locker_clicked(int)));

    // 初始状态
    ResetData();
}

CDashboard_TCB::~CDashboard_TCB()
{
}

void CDashboard_TCB::ResetData()
{
    for (int i = 1; i <= 12; ++i)
    {
        lockers_->button(i)->setProperty("temperature", 0);
        lockers_->button(i)->setProperty("fanstatus", 0x01);
        lockers_->button(i)->setProperty("no", i);
        lockers_->button(i)->setProperty("door", 0x00);
    }

    ui.edt_GetFirmwareVersion->clear();
    ui.combo_boxamount->setCurrentText("12");
    ui.lb_vdc_status->clear();
    ui.lb_electric_status->clear();
    ui.lb_left_defrost_heater_status->clear();
    ui.lb_right_defrost_heater_status->clear();
    ui.lb_left_compressor_status->clear();
    ui.lb_right_compressor_status->clear();
    ui.lb_GetEvaporatorTemperature_left->clear();
    ui.lb_GetEvaporatorTemperature_right->clear();
    ui.lb_evaporator_fan_status->clear();
    ui.edt_DefrostOption_interval->clear();
    ui.edt_DefrostOption_duration->clear();
    ui.edt_DefrostCriticalTemperature->clear();
    ui.edt_DoorFrameHeatingWireOption_interval->clear();
    ui.edt_DoorFrameHeatingWireOption_duration->clear();
    ui.lb_SixPathTemperature_1->clear();
    ui.lb_SixPathTemperature_2->clear();
    ui.lb_SixPathTemperature_3->clear();
    ui.lb_SixPathTemperature_4->clear();
    ui.lb_SixPathTemperature_5->clear();
    ui.lb_SixPathTemperature_6->clear();
    ui.edt_WorkAreaTemperatureThreshold_th->clear();
    ui.edt_WorkAreaTemperatureThreshold_tl->clear();
}

bool CDashboard_TCB::eventFilter(QObject* watched, QEvent* e)
{
    auto btn = qobject_cast<QAbstractButton*>(watched);
    if (lockers_->id(btn) != 0)
    {
        if (e->type() == QEvent::Paint)
        {
            QWidget::eventFilter(watched, e);

            // paint
            QPainter p(btn);
            QFont font;
            font.setPixelSize(14);
            p.setFont(font);
            auto rt = btn->rect();

            // 背景填充
            p.fillRect(rt, QColor("#66CC66"));

            // 绘制门磁状态
            if (btn->property("door").toInt() == 0x01)
            {
                QRect rect;
                rect.setX(rt.topRight().x() - 15);
                rect.setY(rt.topRight().y());
                rect.setWidth(15);
                rect.setHeight(rt.height());
                p.fillRect(rect, Qt::black);
            }

            // 绘制箱号
            {
                p.drawText(rt, Qt::AlignLeft | Qt::AlignTop, btn->property("no").toString());
            }

            // 绘制温度
            {
                p.drawText(rt, Qt::AlignLeft | Qt::AlignBottom, btn->property("temperature").toString());
            }

            // 绘制风扇状态
            {
                p.drawText(rt, Qt::AlignCenter, btn->property("fanstatus").toInt() == 0x00 ? tr("opened") : tr("closed"));
            }
            return true;
        }
    }
    return QWidget::eventFilter(watched, e);
}

void CDashboard_TCB::on_btn_GetFirmwareVersion_clicked()
{
    DEFINE_DEVICE();

    ui.edt_GetFirmwareVersion->setText("");

    char version[256] {0x00};
    auto ret = device->GetFirmwareVersion(version);
    MSG(INFO) << tr("GetFirmwareVersion") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    ui.edt_GetFirmwareVersion->setText(QString(version));
}

void CDashboard_TCB::on_btn_GetDoorStatus_clicked()
{
    DEFINE_DEVICE();

    for (size_t i = 0; i < 12; ++i)
    {
        lockers_->button(i + 1)->setProperty("door", 0x00);
    }

    unsigned char status[256] {0x00};
    size_t len = 256;
    auto ret = device->GetDoorStatus(status, len);
    MSG(INFO) << tr("GetDoorStatus") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    size_t max_cnt = len > 12 ? 12 : len;
    for (size_t i = 0; i < max_cnt; ++i)
    {
        lockers_->button(i + 1)->setProperty("door", status[i]);
    }
    update();
}

void CDashboard_TCB::event_locker_clicked(int i)
{
    DEFINE_DEVICE();

    int boxnum = i;
    unsigned char status = 0x00;
    auto ret = device->OpenLocker(boxnum, status);
    MSG(INFO) << tr("OpenLocker [ %1 ] ").arg(i) << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_GetAllBoxTemperatures_clicked()
{
    DEFINE_DEVICE();

    for (size_t i = 1; i <= 12; ++i)
    {
        lockers_->button(i)->setProperty("temperature", 0);
    }

    int32_t temperature[12] {0};
    size_t len = 12;
    auto ret = device->GetAllBoxTemperatures(temperature, len);
    MSG(INFO) << tr("GetAllBoxTemperatures") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    for (size_t i = 0; i < len; ++i)
    {
        lockers_->button(i + 1)->setProperty("temperature", QString::number(float(temperature[i]) / 100.00, 'f', 2));
    }
    update();
}

void CDashboard_TCB::on_btn_GetEvaporatorTemperature_clicked()
{
    DEFINE_DEVICE();

    ui.lb_GetEvaporatorTemperature_left->setText("");
    ui.lb_GetEvaporatorTemperature_right->setText("");

    int32_t temperature_left(0), temperature_right(0);
    auto ret = device->GetEvaporatorTemperature(temperature_left, temperature_right);
    MSG(INFO) << tr("GetEvaporatorTemperature") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    ui.lb_GetEvaporatorTemperature_left->setText(QString::number(float(temperature_left) / 100.00, 'f', 2));
    ui.lb_GetEvaporatorTemperature_right->setText(QString::number(float(temperature_right) / 100.00, 'f', 2));
}

void CDashboard_TCB::on_btn_SetWorkAreaOption_clicked()
{
    DEFINE_DEVICE();

    unsigned char direction = ui.combo_workarea_direction->currentIndex();
    unsigned char workarea = ui.combo_workarea_type->currentIndex();
    auto ret = device->SetWorkAreaOption(direction, workarea);
    MSG(INFO) << tr("SetWorkAreaOption") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_GetWorkAreaOption_clicked()
{
    DEFINE_DEVICE();

    unsigned char direction = ui.combo_workarea_direction->currentIndex();
    unsigned char workarea = 0x00;
    auto ret = device->GetWorkAreaOption(direction, workarea);
    MSG(INFO) << tr("GetWorkAreaOption") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    ui.combo_workarea_type->setCurrentIndex(workarea);
}

void CDashboard_TCB::on_btn_GetDeviceStatus_clicked()
{
    DEFINE_DEVICE();

    for (int i = 1; i <= 12; ++i)
    {
        lockers_->button(i)->setProperty("fanstatus", 0x01);
    }

    ui.lb_vdc_status->setText("");
    ui.lb_electric_status->setText("");
    ui.lb_left_defrost_heater_status->setText("");
    ui.lb_right_defrost_heater_status->setText("");
    ui.lb_left_compressor_status->setText("");
    ui.lb_right_compressor_status->setText("");

    // 共风道
    ui.lb_vdc_status->setText("");
    ui.lb_electric_status->setText("");
    ui.lb_left_defrost_heater_status->setText("");
    ui.lb_right_defrost_heater_status->setText("");
    ui.lb_left_compressor_status->setText("");
    ui.lb_right_compressor_status->setText("");
    ui.lb_evaporator_fan_status->setText("");

    zl::zlbase::TcbDeviceStatus device_status;
    auto ret = device->GetDeviceStatus(device_status);
    MSG(INFO) << tr("GetDeviceStatus") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    auto pfunc_convert1 = [](unsigned char status) -> QString {
        if (status == 0x00)
            return tr("opened");
        else if (status == 0x01)
            return tr("closed");
        else
            return tr("unknown");
    };

    auto pfunc_convert2 = [](unsigned char status) -> QString {
        if (status == 0x00)
            return tr("normal");
        else if (status == 0x01)
            return tr("under-voltage");
        else if (status == 0x10)
            return tr("over-voltage");
        else
            return tr("unknown");
    };

    auto pfunc_convert3 = [](unsigned char status) -> QString {
        if (status == 0x00)
            return tr("normal");
        else if (status == 0x01)
            return tr("overload");
        else
            return tr("unknown");
    };

    if (device_status.type == 0x00)
    {
        // 独立格口
        lockers_->button(1)->setProperty("fanstatus", device_status.icr.box1_evaporator_fan_status);
        lockers_->button(2)->setProperty("fanstatus", device_status.icr.box2_evaporator_fan_status);
        lockers_->button(3)->setProperty("fanstatus", device_status.icr.box3_evaporator_fan_status);
        lockers_->button(4)->setProperty("fanstatus", device_status.icr.box4_evaporator_fan_status);
        lockers_->button(5)->setProperty("fanstatus", device_status.icr.box5_evaporator_fan_status);
        lockers_->button(6)->setProperty("fanstatus", device_status.icr.box6_evaporator_fan_status);
        lockers_->button(7)->setProperty("fanstatus", device_status.icr.box7_evaporator_fan_status);
        lockers_->button(8)->setProperty("fanstatus", device_status.icr.box8_evaporator_fan_status);
        lockers_->button(9)->setProperty("fanstatus", device_status.icr.box9_evaporator_fan_status);
        lockers_->button(10)->setProperty("fanstatus", device_status.icr.box10_evaporator_fan_status);
        lockers_->button(11)->setProperty("fanstatus", device_status.icr.box11_evaporator_fan_status);
        lockers_->button(12)->setProperty("fanstatus", device_status.icr.box12_evaporator_fan_status);

        ui.lb_vdc_status->setText(pfunc_convert2(device_status.icr.voltage_status));
        ui.lb_electric_status->setText(pfunc_convert3(device_status.icr.electricity_status));
        ui.lb_left_defrost_heater_status->setText(pfunc_convert1(device_status.icr.left_defrost_heater_status));
        ui.lb_right_defrost_heater_status->setText(pfunc_convert1(device_status.icr.right_defrost_heater_status));
        ui.lb_left_compressor_status->setText(pfunc_convert1(device_status.icr.left_compressor_status));
        ui.lb_right_compressor_status->setText(pfunc_convert1(device_status.icr.right_compressor_status));

        update();
    }
    else if (device_status.type == 0x01)
    {
        // 共风道
        ui.lb_vdc_status->setText(pfunc_convert2(device_status.sdr.voltage_status));
        ui.lb_electric_status->setText(pfunc_convert3(device_status.sdr.electricity_status));
        ui.lb_left_defrost_heater_status->setText(pfunc_convert1(device_status.sdr.defrost_status));
        ui.lb_right_defrost_heater_status->setText("");
        ui.lb_left_compressor_status->setText(pfunc_convert1(device_status.sdr.compressor_status));
        ui.lb_right_compressor_status->setText("");
        ui.lb_evaporator_fan_status->setText(pfunc_convert1(device_status.sdr.evaporator_fan_status));
    }
}

void CDashboard_TCB::on_btn_SetBoxAmount_clicked()
{
    DEFINE_DEVICE();

    int amount = ui.combo_boxamount->currentText().toInt();
    auto ret = device->SetBoxAmount(uint8_t(amount));
    MSG(INFO) << tr("SetBoxAmount") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_GetBoxAmount_clicked()
{
    DEFINE_DEVICE();

    unsigned char amount(0);
    auto ret = device->GetBoxAmount(amount);
    MSG(INFO) << tr("GetBoxAmount") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    ui.combo_boxamount->setCurrentText(QString::number(amount));
}

void CDashboard_TCB::on_btn_EnableDefrost_left_clicked()
{
    DEFINE_DEVICE();

    auto ret = device->EnableDefrost(0x00, 0x01);
    MSG(INFO) << tr("EnableDefrost left") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_DisableDefrost_left_clicked()
{
    DEFINE_DEVICE();

    auto ret = device->EnableDefrost(0x00, 0x00);
    MSG(INFO) << tr("DisableDefrost left") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_EnableDefrost_right_clicked()
{
    DEFINE_DEVICE();

    auto ret = device->EnableDefrost(0x01, 0x01);
    MSG(INFO) << tr("EnableDefrost right") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_DisableDefrost_right_clicked()
{
    DEFINE_DEVICE();

    auto ret = device->EnableDefrost(0x01, 0x00);
    MSG(INFO) << tr("DisableDefrost right") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_SetDefrostOption_clicked()
{
    DEFINE_DEVICE();

    unsigned char direction = ui.combo_DefrostOption_direction->currentIndex();
    unsigned char interval = ui.edt_DefrostOption_interval->text().toInt() / 30;
    unsigned char duration = ui.edt_DefrostOption_duration->text().toInt();
    auto ret = device->SetDefrostOption(direction, interval, duration);
    MSG(INFO) << tr("SetDefrostOption") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_GetDefrostOption_clicked()
{
    DEFINE_DEVICE();

    ui.edt_DefrostOption_interval->setText("");
    ui.edt_DefrostOption_duration->setText("");

    unsigned char direction = ui.combo_DefrostOption_direction->currentIndex();
    unsigned char interval(0x00), duration(0x00);
    auto ret = device->GetDefrostOption(direction, interval, duration);
    MSG(INFO) << tr("GetDefrostOption") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    ui.edt_DefrostOption_interval->setText(QString::number(interval * 30));
    ui.edt_DefrostOption_duration->setText(QString::number(duration));
}

void CDashboard_TCB::on_btn_SetDefrostMode_clicked()
{
    DEFINE_DEVICE();

    unsigned char mode = ui.combo_DefrostMode->currentIndex();
    auto ret = device->SetDefrostMode(mode);
    MSG(INFO) << tr("SetDefrostMode") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_GetDefrostMode_clicked()
{
    DEFINE_DEVICE();

    unsigned char mode(0x00);
    auto ret = device->GetDefrostMode(mode);
    MSG(INFO) << tr("GetDefrostMode") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    ui.combo_DefrostMode->setCurrentIndex(mode);
}

void CDashboard_TCB::on_btn_SetDefrostCriticalTemperature_clicked()
{
    DEFINE_DEVICE();

    int32_t temperature = ui.edt_DefrostCriticalTemperature->text().toFloat() * 100;
    auto ret = device->SetDefrostCriticalTemperature(temperature);
    MSG(INFO) << tr("SetDefrostCriticalTemperature") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_GetDefrostCriticalTemperature_clicked()
{
    DEFINE_DEVICE();

    ui.edt_DefrostCriticalTemperature->setText("");

    int32_t temperature(0);
    auto ret = device->GetDefrostCriticalTemperature(temperature);
    MSG(INFO) << tr("GetDefrostCriticalTemperature") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    ui.edt_DefrostCriticalTemperature->setText(QString::number(float(temperature) / 100.00, 'f', 2));
}

void CDashboard_TCB::on_btn_SetWorkAreaTemperatureThreshold_clicked()
{
    DEFINE_DEVICE();

    unsigned char workarea = ui.combo_WorkAreaTemperatureThreshold_workarea->currentIndex();
    int32_t tl = ui.edt_WorkAreaTemperatureThreshold_tl->text().toFloat() * 100;
    int32_t th = ui.edt_WorkAreaTemperatureThreshold_th->text().toFloat() * 100;
    auto ret = device->SetWorkAreaTemperatureThreshold(workarea, tl, th);
    MSG(INFO) << tr("SetWorkAreaTemperatureThreshold") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_GetWorkAreaTemperatureThreshold_clicked()
{
    DEFINE_DEVICE();

    ui.edt_WorkAreaTemperatureThreshold_th->setText("");
    ui.edt_WorkAreaTemperatureThreshold_tl->setText("");

    unsigned char workarea = ui.combo_WorkAreaTemperatureThreshold_workarea->currentIndex();
    int32_t tl(0), th(0);
    auto ret = device->GetWorkAreaTemperatureThreshold(workarea, tl, th);
    MSG(INFO) << tr("GetWorkAreaTemperatureThreshold") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    ui.edt_WorkAreaTemperatureThreshold_th->setText(QString::number(float(th) / 100.00, 'f', 2));
    ui.edt_WorkAreaTemperatureThreshold_tl->setText(QString::number(float(tl) / 100.00, 'f', 2));
}

void CDashboard_TCB::on_btn_EnableOutdoorLamp_clicked()
{
    DEFINE_DEVICE();

    auto ret = device->EnableOutdoorLamp(0x01);
    MSG(INFO) << tr("EnableOutdoorLamp") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_DisableOutdoorLamp_clicked()
{
    DEFINE_DEVICE();

    auto ret = device->EnableOutdoorLamp(0x00);
    MSG(INFO) << tr("DisableOutdoorLamp") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_SetDoorFrameHeatingWireOption_clicked()
{
    DEFINE_DEVICE();

    unsigned char interval = ui.edt_DoorFrameHeatingWireOption_interval->text().toInt() / 30;
    unsigned char duration = ui.edt_DoorFrameHeatingWireOption_duration->text().toInt();
    auto ret = device->SetDoorFrameHeatingWireOption(interval, duration);
    MSG(INFO) << tr("SetDoorFrameHeatingWireOption") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_GetDoorFrameHeatingWireOption_clicked()
{
    DEFINE_DEVICE();

    ui.edt_DoorFrameHeatingWireOption_interval->setText("");
    ui.edt_DoorFrameHeatingWireOption_duration->setText("");

    unsigned char interval(0), duration(0);
    auto ret = device->GetDoorFrameHeatingWireOption(interval, duration);
    MSG(INFO) << tr("GetDoorFrameHeatingWireOption") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    ui.edt_DoorFrameHeatingWireOption_interval->setText(QString::number(interval * 30));
    ui.edt_DoorFrameHeatingWireOption_duration->setText(QString::number(duration));
}

void CDashboard_TCB::on_btn_SetTemperatureDisplayMode_clicked()
{
    DEFINE_DEVICE();

    unsigned char mode = ui.combo_TemperatureDisplayMode->currentIndex();
    auto ret = device->SetTemperatureDisplayMode(mode);
    MSG(INFO) << tr("SetTemperatureDisplayMode") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }
}

void CDashboard_TCB::on_btn_GetSixPathTemperature_clicked()
{
    DEFINE_DEVICE();

    ui.lb_SixPathTemperature_1->setText("");
    ui.lb_SixPathTemperature_2->setText("");
    ui.lb_SixPathTemperature_3->setText("");
    ui.lb_SixPathTemperature_4->setText("");
    ui.lb_SixPathTemperature_5->setText("");
    ui.lb_SixPathTemperature_6->setText("");

    int32_t temperature_list[6] {0};
    size_t len = 6;
    auto ret = device->GetSixPathTemperature(temperature_list, len);
    MSG(INFO) << tr("GetSixPathTemperature") << CRet(ret);
    if (ret != zl::zlbase::ZLResult_Success)
    {
        return;
    }

    ui.lb_SixPathTemperature_1->setText(QString::number(float(temperature_list[0]) / 100.00, 'f', 2));
    ui.lb_SixPathTemperature_2->setText(QString::number(float(temperature_list[1]) / 100.00, 'f', 2));
    ui.lb_SixPathTemperature_3->setText(QString::number(float(temperature_list[2]) / 100.00, 'f', 2));
    ui.lb_SixPathTemperature_4->setText(QString::number(float(temperature_list[3]) / 100.00, 'f', 2));
    ui.lb_SixPathTemperature_5->setText(QString::number(float(temperature_list[4]) / 100.00, 'f', 2));
    ui.lb_SixPathTemperature_6->setText(QString::number(float(temperature_list[5]) / 100.00, 'f', 2));
}